{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "浅学一下 - 导入外部csv文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Make</th>\n",
       "      <th>Colour</th>\n",
       "      <th>Odometer (KM)</th>\n",
       "      <th>Doors</th>\n",
       "      <th>Price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Toyota</td>\n",
       "      <td>White</td>\n",
       "      <td>150043</td>\n",
       "      <td>4</td>\n",
       "      <td>$4,000.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Honda</td>\n",
       "      <td>Red</td>\n",
       "      <td>87899</td>\n",
       "      <td>4</td>\n",
       "      <td>$5,000.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Toyota</td>\n",
       "      <td>Blue</td>\n",
       "      <td>32549</td>\n",
       "      <td>3</td>\n",
       "      <td>$7,000.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BMW</td>\n",
       "      <td>Black</td>\n",
       "      <td>11179</td>\n",
       "      <td>5</td>\n",
       "      <td>$22,000.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Nissan</td>\n",
       "      <td>White</td>\n",
       "      <td>213095</td>\n",
       "      <td>4</td>\n",
       "      <td>$3,500.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Toyota</td>\n",
       "      <td>Green</td>\n",
       "      <td>99213</td>\n",
       "      <td>4</td>\n",
       "      <td>$4,500.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Honda</td>\n",
       "      <td>Blue</td>\n",
       "      <td>45698</td>\n",
       "      <td>4</td>\n",
       "      <td>$7,500.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Honda</td>\n",
       "      <td>Blue</td>\n",
       "      <td>54738</td>\n",
       "      <td>4</td>\n",
       "      <td>$7,000.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Toyota</td>\n",
       "      <td>White</td>\n",
       "      <td>60000</td>\n",
       "      <td>4</td>\n",
       "      <td>$6,250.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Nissan</td>\n",
       "      <td>White</td>\n",
       "      <td>31600</td>\n",
       "      <td>4</td>\n",
       "      <td>$9,700.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     Make Colour  Odometer (KM)  Doors       Price\n",
       "0  Toyota  White         150043      4   $4,000.00\n",
       "1   Honda    Red          87899      4   $5,000.00\n",
       "2  Toyota   Blue          32549      3   $7,000.00\n",
       "3     BMW  Black          11179      5  $22,000.00\n",
       "4  Nissan  White         213095      4   $3,500.00\n",
       "5  Toyota  Green          99213      4   $4,500.00\n",
       "6   Honda   Blue          45698      4   $7,500.00\n",
       "7   Honda   Blue          54738      4   $7,000.00\n",
       "8  Toyota  White          60000      4   $6,250.00\n",
       "9  Nissan  White          31600      4   $9,700.00"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "car_sales = pd.read_csv('car-sales.csv')\n",
    "car_sales"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "car_sales.to_csv('car-sales-export.csv',index=False)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "cc5f70855ac006f3de45a3cc3b9e7d8d53845e50458809cb162b0174266dec97"
  },
  "kernelspec": {
   "display_name": "Python 3.9.7 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
